{extend name="$base" /}
{block name="resources"}
<link href="WAP_CSS/distribution_team.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="WAP_CSS/member_point.css">
<style>
	.team_sales{
		position: absolute;
		right: 5px;
		top: 35px;
	}

</style>
{/block}

{block name="main"}
{php}
$promoter_id = input('uid', '');
// 会员账户信息
$member_account = api("System.Member.memberAccount");
$member_account = $member_account['data'];



{/php}
<div class="team">
	<div class="team-list mescroll member-point " id="list_mescroll" style="top: 44px">
		<div class="account-box ns-border-color radius-wrapper">
			<p class="balance" style="font-size: 24px">{$member_account.team_sales}（{$member_account.yestoday_team_sales}）</p>
			<p class="p-style">{:lang('团队业绩')}（今日新增）</p>
		</div>
		<ul class="list-content radius-wrapper">

		</ul>
	</div>
</div>
{/block}
{block name="footer"}{/block}
{block name="script"}
<script>
var mescroll = new ScrollList("list_mescroll", loadinfo);	

$(function(){
	$('.team nav li').click(function(event) {
		$(this).addClass('active ns-bg-color').siblings('li').removeClass('active ns-bg-color');
		loadinfo(1, false)
	});
})

function loadinfo(page_index, is_append){
	var params = {
		uid : {$uid},
		page : page_index,
		type : $('.team nav .active').attr('data-type')
	}
	var html = '';
	api("System.Member.team", params, function (res) {
		var data = res.data;
		var list = data.data;
		if (list.length > 0) {
			$(list).each(function (index, item) {
				item.user_headimg = item.user_headimg ? item.user_headimg : '{$default_headimg}';
				html += `
					<div class="team-item ns-border-color-gray">
						<img src="`+ __IMG(item.user_headimg) +`"/>
						<div class="team-info">
							<strong class="ns-text-color-black">`+ item.user_name +`</strong>
							<strong class="role-name ns-text-color">(`+ item.level_name +`)</strong><br>`;

					html += `<strong class="role-user ns-text-color-gray">{:lang('member_nickname')}：`+ item.nick_name +`</strong><br>`;

				html += `<time class="ns-text-color-gray">{:lang('registration_time')}：`+ timeStampTurnTime(item.reg_time) +`</time>
						</div>
						<div class="team_sales">团队业绩：`+ item.team_sales+`</div>
					</div>
				`;
			})
		} else {
			html += '<p class="empty">{:lang("you_not_have_team")}</p>';
		}
		if (is_append) $("#list_mescroll ul").append(html);
		else $("#list_mescroll ul").html(html);
		mescroll.endByPage(data.total_count, data.page_count);
	})
}
</script>
{/block}